<template>
  <div class="mrt mrtj">
    <div class="mrt1">
      <a href>
        每日特价
        <div class="ppsg-a"></div>
        <span>></span>
      </a>
    </div>
    <div class>
      <div class="mr-item">
        <div class="mr-items" 
        v-for="(mritem, index) in mritems" 
        :key="mritem.id"
        @mouseover="tabs(index)"
        
        >
          <a href :style="mritems[filter]===mritems[index] ? 'color:red;' : ''">
            {{mritem.text}}
          </a>
        </div>
      </div>
      <div class="tab">
        <!-- 精选 -->
        <div class="tab-main" 
        :style="tabitems[filter]===tabitems[index] ? 'display: block;' : ''" 
        v-for="(tabitem, index) in tabitems" 
        :key="index"
        
        >
          <div class="main-item1">
            <a href="#">
              <div class="minplc">
                <span>{{tabitem.minplc1}}</span>
              </div>
              <img :src="tabitem.src1" alt class="opacity tmimg" />
              <div class="tm">
                <span class="tm-name">{{tabitem.name1}}</span>
                <div class="tm-plice">
                  <span class="now-plice">{{tabitem.nowplice1}}</span>
                  <span class="old-plice">{{tabitem.oldplice1}}</span>
                </div>
                <span class="qg">
                  已抢
                  <span>{{tabitem.num1}}</span>件
                </span>
              </div>
            </a>
          </div>
          <div class="main-item2">
            <a href>
              <div class="minplc1">
                <span>{{tabitem.minplc2}}</span>
              </div>
              <img
                :src="tabitem.src2"
                style="width: 84px;height: 84px;"
                alt
                class="opacity"
              />
              <div class="tm1">
                <span class="tm-name1">{{tabitem.name2}}</span>
                <div class="tm-plice1">
                  <span class="now-plice1">{{tabitem.nowplice2}}</span>
                  <span class="old-plice">{{tabitem.oldplice2}}</span>
                </div>
                <span class="qg">
                  已抢
                  <span>{{tabitem.num2}}</span>件
                </span>
              </div>
            </a>
          </div>
          <div class="main-item2">
            <a href>
              <div class="minplc1">
                <span>{{tabitem.minplc3}}</span>
              </div>
              <img
                :src="tabitem.src3"
                alt
                style="width: 84px;height: 84px;"
                class="opacity"
              />
              <div class="tm1">
                <span class="tm-name1">{{tabitem.name3}}</span>
                <div class="tm-plice">
                  <span class="now-plice1">{{tabitem.nowplice3}}</span>
                  <span class="old-plice">{{tabitem.oldplice3}}</span>
                </div>
                <span class="qg">
                  已抢
                  <span>{{tabitem.num3}}</span>件
                </span>
              </div>
            </a>
          </div>
          <div class="main-item2">
            <a href>
              <div class="minplc1">
                <span>{{tabitem.minplc4}}</span>
              </div>
              <img :src="tabitem.src4" alt style="width: 84px;height: 84px;" class="opacity" />
              <div class="tm1">
                <span class="tm-name1">{{tabitem.name4}}</span>
                <div class="tm-plice">
                  <span class="now-plice1">{{tabitem.nowplice4}}</span>
                  <span class="old-plice">{{tabitem.oldplice4}}</span>
                </div>
                <span class="qg">
                  已抢
                  <span>{{tabitem.num4}}</span>件
                </span>
              </div>
            </a>
          </div>
          <div class="main-item2">
            <a href>
              <div class="minplc1">
                <span>{{tabitem.minplc5}}</span>
              </div>
              <img
                :src="tabitem.src5"
                alt=""
                style="width: 84px;height: 84px;"
                class="opacity"
              />
              <div class="tm1">
                <span class="tm-name1">{{tabitem.name5}}</span>
                <div class="tm-plice">
                  <span class="now-plice1">{{tabitem.nowplice5}}</span>
                  <span class="old-plice">{{tabitem.oldp5ice4}}</span>
                </div>
                <span class="qg">
                  已抢
                  <span>{{tabitem.num5}}</span>件
                </span>
              </div>
            </a>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      filter: '0',
      mritems: [
        { text: "精选", id: '1' },
        { text: "美食", id: '2' },
        { text: "数码", id: '3' },
        { text: "百货", id: '4' },
        { text: "预告", id: '5' }
      ],
      tabitems:[
        {
          id:'1',

          minplc1: '293天最低价',
          src1: require('../images/jiake.jpg'),
          name1: '插头',
          nowplice1: '￥99',
          oldplice1: '￥199',
          num1: '559',

          minplc2: '300天最低价',
          src2: require('../images/yurongfu.jpg'),
          name2: '充电宝',
          nowplice2: '￥99',
          oldplice2: '￥199',
          num2: '5259',

          minplc3: '93天最低价',
          src3: require('../images/juzi.jpg'),
          name3: '蓝牙音箱',
          nowplice3: '￥99',
          oldplice3: '￥199',
          num3: '559',

          minplc4: '113天最低价',
          src4: require('../images/pingguo.jpg'),
          name4: '鼠标',
          nowplice4: '￥99',
          oldplice4: '￥199',
          num4: '559',

          minplc5: '197天最低价',
          src5: require('../images/chengziu.jpg'),
          name5: '耳机',
          nowplice5: '￥99',
          oldplice5: '￥199',
          num5: '559',
        },
        {
          id: '2',
          minplc1: '293天最低价',
          src1: require('../images/3e4fd3ba4a38fe95.jpg'),
          name1: '插头',
          nowplice1: '￥99',
          oldplice1: '￥199',
          num1: '559',

          minplc2: '293天最低价',
          src2: require('../images/cd5cdce12c15fc76.jpg'),
          name2: '插头',
          nowplice2: '￥99',
          oldplice2: '￥199',
          num2: '559',

          minplc3: '293天最低价',
          src3: require('../images/40475431334866c3.jpg'),
          name3: '插头',
          nowplice3: '￥99',
          oldplice3: '￥199',
          num3: '559',

          minplc4: '293天最低价',
          src4: require('../images/176a52abe72f42cf.jpg'),
          name4: '插头',
          nowplice4: '￥99',
          oldplice4: '￥199',
          num4: '559',

          minplc5: '293天最低价',
          src5: require('../images/5384731add9275f3.jpg'),
          name5: '插头',
          nowplice5: '￥99',
          oldplice5: '￥199',
          num5: '559',
        },
        {
          id: 'e3',

          minplc1: '293天最低价',
          src1: require('../images/yaogao.jpg'),
          name1: '插头',
          nowplice1: '￥99',
          oldplice1: '￥199',
          num1: '559',

          minplc2: '293天最低价',
          src2: require('../images/xifashui.webp.jpg'),
          name2: '插头',
          nowplice2: '￥99',
          oldplice2: '￥199',
          num2: '559',

          minplc3: '293天最低价',
          src3: require('../images/hufashui.jpg'),
          name3: '插头',
          nowplice3: '￥99',
          oldplice3: '￥199',
          num3: '559',

          minplc4: '293天最低价',
          src4: require('../images/pengwu.jpg'),
          name4: '插头',
          nowplice4: '￥99',
          oldplice4: '￥199',
          num4: '559',

          minplc5: '293天最低价',
          src5: require('../images/weishengshu.jpg'),
          name5: '插头',
          nowplice5: '￥99',
          oldplice5: '￥199',
          num5: '559',
        },
        {
          id: '4',
          minplc1: '293天最低价',
          src1: require('../images/shafa.jpg'),
          name1: '插头',
          nowplice1: '￥99',
          oldplice1: '￥199',
          num1: '559',

          minplc2: '293天最低价',
          src2: require('../images/chuang.jpg'),
          name2: '插头',
          nowplice2: '￥99',
          oldplice2: '￥199',
          num2: '559',

          minplc3: '293天最低价',
          src3: require('../images/jiarongniuzai.jpg'),
          name3: '插头',
          nowplice3: '￥99',
          oldplice3: '￥199',
          num3: '559',

          minplc4: '293天最低价',
          src4: require('../images/zhengmaoshang.jpg'),
          name4: '插头',
          nowplice4: '￥99',
          oldplice4: '￥199',
          num4: '559',

          minplc5: '293天最低价',
          src5: require('../images/muzhishafa.jpg'),
          name5: '插头',
          nowplice5: '￥99',
          oldplice5: '￥199',
          num5: '559',
        },
        {
          id: '5',
          minplc1: '293天最低价',
          src1: require('../images/hua.jpg'),
          name1: '插头',
          nowplice1: '￥99',
          oldplice1: '￥199',
          num1: '559',

          minplc2: '293天最低价',
          src2: require('../images/zhengmaoshang.jpg'),
          name2: '插头',
          nowplice2: '￥99',
          oldplice2: '￥199',
          num2: '559',

          minplc3: '293天最低价',
          src3: require('../images/pingguo.jpg'),
          name3: '插头',
          nowplice3: '￥99',
          oldplice3: '￥199',
          num3: '559',

          minplc4: '293天最低价',
          src4: require('../images/jiake.jpg'),
          name4: '插头',
          nowplice4: '￥99',
          oldplice4: '￥199',
          num4: '559',

          minplc5: '293天最低价',
          src5: require('../images/yurongfu.jpg'),
          name5: '插头',
          nowplice5: '￥99',
          oldplice5: '￥199',
          num5: '559',
        },
      ]
    }
  },
  methods:{
    tabs(index){
      // console.log(index)
      this.filter = index
      
    }
  }
};
</script>

<style lang="stylus" scoped>
.mrt {
  position: relative;
  width: 590px;
  height: 100%;
  background-color: white;
}

.mrtj {
  float: left;
}

.ppsg {
  float: right;
}

.mrt1 {
  width: 150px;
  height: 60px;
}

.mrt1 a {
  position: relative;
  left: 15px;
  top: 10px;
  font-weight: 800;
  font-size: 25px;
  color: #000000;
}

.mrt1 a span {
  position: relative;
  left: 107px;
  top: -55px;
  font-weight: 800;
  font-size: 15px;
  color: #e1251b;
}

.ppsg-a {
  position: relative;
  width: 18px;
  height: 18px;
  left: 102px;
  top: -24px;
  border: 1px solid #e1251b;
  border-radius: 50%;
}

.mrt1:hover .ppsg-a {
  background-color: #e1251b;
}

.mrt1:hover span {
  color: white;
}

.mr-item {
  position: absolute;
  width: 260px;
  height: 21px;
  top: 20px;
  right: 0;
}

.mr-items {
  float: left;
  margin: 0 10px;
}

.tab {
  width: 570px;
  height: 270px;
  margin: 1px 10px;
}

.tab-main {
  display: none;
  width: 100%;
  height: 100%;
}

.main-item1 {
  position: relative;
  float: left;
  width: 170px;
  height: 236px;
}

.main-item2 {
  position: relative;
  margin-left: 15px;
  margin-top: 15px;
  margin-bottom: 25px;
  display: inline-block;
  width: 170px;
  height: 89px;
}

.ppsg-i {
  position: absolute;
  right: 10px;
  top: 17px;
  width: 300px;
  height: 315px;
  /* border: 1px solid red; */
}

.p-item1-img {
  position: relative;
  display: block;
  width: 70px;
  height: 35px;
  left: 110px;
  top: 30px;
}

.p-item1-imges {
  position: relative;
  display: block;
  width: 130px;
  height: 130px;
  left: 80px;
  top: 30px;
}

.tab-main a, .tab-item a {
  color: #000;
}

.tab-main a:hover, .tab-item a:hover {
  color: #000;
}

.p-item1-w {
  position: relative;
  left: 102px;
  top: 30px;
}

.ppsg-is {
  margin-bottom: 10px;
  margin-left: 10px;
  float: left;
  width: 135px;
  height: 100px;
}

.opacity {
  opacity: 1;
}

.main-item1:hover a .opacity, .main-item2:hover a .opacity, .opacity:hover {
  opacity: 0.8;
}

.minplc {
  position: absolute;
  width: 90px;
  height: 24px;
  /* border: 1px solid red; */
  text-align: center;
  background-image: url('../images/xiazai.png');
}

.minplc span {
  color: #fff;
  font-size: 14px;
  font-weight: 500px;
}

.tmimg {
  width: 120px;
  height: 120px;
  position: absolute;
  display: block;
  left: 25px;
  top: 45px;
}

.tm {
  position: absolute;
  width: 100%;
  height: 70px;
  text-align: center;
  bottom: 0;
}

.tm-name {
  margin-left: 10px;
  font-size: 14px;
  width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  height: 19px;
  display: block;
  text-align: center;
}

.main-item1:hover a .tm .tm-name, .main-item2:hover a .tm1 .tm-name1 {
  color: #e1251b;
}

.tm-plice {
  margin-top: 5px;
}

.now-plice {
  font-size: 18px;
  color: #e1251b;
}

.old-plice {
  text-decoration: line-through;
}

.old-plice, .qg {
  font-size: 12px;
  color: #333;
  opacity: 0.8;
}

.qg span {
  color: #e1251b;
}

.minplc1 {
  position: absolute;
  bottom: 2px;
  z-index: 100;
  width: 84px;
  height: 19px;
  background: rgba(0, 0, 0, 0.6);
  text-align: center;
}

.minplc1 span {
  position: relative;
  color: #FFF;
  font-size: 12px;
  top: -2px;
}

.tm1 {
  width: 80px;
  position: absolute;
  right: 0;
  top: 0;
}

.tm-name1 {
  margin-top: 5px;
  margin-bottom: 5px;
  width: 75px;
  height: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
  color: #333;
  display: block;
}

.now-plice1 {
  display: block;
  font-size: 14px;
  color: #e1251b;
}

.tab-item {
  width: 100%;
  height: 100%;
}
</style>